#include<iostream>
using namespace std;
void test02(){
    int L, R;
    cin >> L >> R;
    int count = 0;
    for (size_t i = L; i <= R; i++) {
        /*if (i / 1000 >= 1) {
            if (i / 1000 == 2)
                count++;
            i /= 1000;
            if (i / 100 >= 1) {
                if (i / 100 == 2)
                    count++;
                i /= 100;
            }
        }*/
        int tmp3 = i;
        int cur = 1000;
        int tmp = i / cur;
        while (tmp==0) {
            cur /= 10;
            tmp = i / cur;
        }
        int tmp2 = i;
        while (cur != 0) {
            tmp2 = i/cur;
            if (tmp2 == 2)
                count++;
             i %= cur;
            cur /= 10;
        }
        i = tmp3;
    }
    cout << count << endl;
}